Cmd

Superclass:
NSObject
Declared In:

Introduction

所有命令类(Esc,TSC,cpcl,针打)的基类 The base class for all command classes (Esc, TSC, cpcl, and pin)



Methods

-AddMemory:Addsize:
-Append:
-Append:len:

添加指令,到缓存中,以便最后调用GetCmd时,使用 * Add instructions to the cache for use in the last call to GetCmd

-Clear
-GetAskPrintOkCmd
-GetBarCodeCmd:codeType:scode:codeError:
-GetBeepCmd:interval:
-GetBitMapCmd:image:
-GetBitMapCmdExt:image:
-GetCmd
-GetCodePageCmd:
-GetCRCmd
-GetCutPaperCmd:
-GetFeedAndCutPaperCmd:FeedDistance:
-GetHeaderCmd
-GetHeaderCmd:
-GetLFCmd
-GetLFCRCmd
-GetNullData
-GetOpenDrawerCmd:startTime:endTime:
-GetPrintEndCmd
-GetPrintEndCmd:
-GetPrintStautsCmd:
-GetSelftestCmd
-GetTextCmd:text:
-ImportData:
-MoveData:dest:index:
-MoveData:ibegin:len:dest:dindex:

AddMemory:Addsize:


-(BOOL)AddMemory:(Byte *)buff Addsize:(NSInteger)Addsize; 
Parameters
buff

Memory to expand

Addsize

要扩展的尺寸 The size to be expanded

Discussion

Expand memory


Append:


-(void)Append:(NSData *)data; 
Parameters
data

指令数据

Discussion

* 添加指令,到缓存中,以便最后调用GetCmd时,使用 Add instructions to the cache for use in the last call to GetCmd


Append:len:


添加指令,到缓存中,以便最后调用GetCmd时,使用 * Add instructions to the cache for use in the last call to GetCmd

-(void)Append:(Byte*)bytes len:(NSInteger)len; 
Parameters
bytes

要添加的指令 Instructions to be added

len

指令长度 Instruction length

Discussion

*


Clear


-(void)Clear; 
Discussion

清除缓存数据 Clear the cache data


GetAskPrintOkCmd


-(NSData *)GetAskPrintOkCmd; 
Discussion

询问是否打印成功,成功能返回$80,失败不返回,适用于定制客户 Rpp80Use Ask if the print is successful, the function returns $80, failure does not return For custom customers Rpp80Use


GetBarCodeCmd:codeType:scode:codeError:


-(NSData *_Nullable) GetBarCodeCmd:(BarcodeSetting *_Nonnull)barcodeset 
        codeType:(BarcodeType)codeType scode:(nonnull NSString * )scode 
        codeError:(PrinterCodeError *_Nonnull)codeError; 
Parameters
barcodeset

条码设置 Barcode settings

codeType

条码类型 Barcode type

scode

条码内容 Barcode content

codeError

错误代码 error code

Return Value

NSData

Discussion

获取条码指令 Get barcode instructions


GetBeepCmd:interval:


- (NSData *) GetBeepCmd:(Byte)level interval:(Byte)interval; 
Parameters
level

次数 frequency

interval

单次时间(single time) interval*100 ms

Discussion

发出beep声 Beep sound


GetBitMapCmd:image:


-(NSData *) GetBitMapCmd:(BitmapSetting *) bitmapSetting 
        image:(UIImage *) image; 
Parameters
bitmapSetting

图片设置 image setting

image

image

Return Value

NSData

Discussion

获取图片打印命令 Get the picture print order


GetBitMapCmdExt:image:


-(NSData *) GetBitMapCmdExt:(BitmapSetting *) bitmapSetting 
        image:(UIImage *) image; 
Parameters
bitmapSetting

图片设置 image setting

image

image

Return Value

NSData

Discussion

获取图片打印命令 (用于Esc命令,打印长图片时,并且用wifi,usb连接) Get the picture print order(Used for the Esc command, when printing long images, and connected with wifi, usb)


GetCmd


-(NSData *_Nullable) GetCmd; 
Return Value

NSData

Discussion

*获取所有通过调用Append方法生成的指令 *Get all the instructions generated by calling the Append method


GetCodePageCmd:


-(NSData *)GetCodePageCmd:(NSString *)codepage; 
Discussion

设置codepage set the codepage for ESC


GetCRCmd


-(NSData *) GetCRCmd; 
Return Value

NSData

Discussion

获取打印回车的指令 Get print carriage return instruction


GetCutPaperCmd:


- (NSData *) GetCutPaperCmd:(CutterMode) cutterMode; 
Parameters
cutterMode

切刀模式 Cutter mode

Discussion

切纸控制命令 Paper cutting control command


GetFeedAndCutPaperCmd:FeedDistance:


- (NSData *) GetFeedAndCutPaperCmd:(BOOL)isFeed FeedDistance:(Byte)FeedDistance; 
Parameters
isFeed

YES:部分切纸 Part cut paper NO:进纸, 并且进行部分切纸(保留一点不切) Feed, and cut some paper (keep a bit not cut)

FeedDistance

进纸距离[n+0.125 毫米] Feed distance [n + 0.125 mm]

Discussion

选择切纸模式并切纸 (for ESC) Select the cut mode and cut the paper


GetHeaderCmd


-(NSData *) GetHeaderCmd; 
Discussion

获取初始化命令头 Get initialization command header


GetHeaderCmd:


-(NSData *) GetHeaderCmd:(CommonSetting *_Nonnull)ComSetting; 
Discussion

获取初始化命令头,并根据ComSetting设置相关参数 Get initialization command header, and set parameters according to ComSetting


GetLFCmd


-(NSData *) GetLFCmd; 
Return Value

NSData

Discussion

获取换行的指令 Get line feed instruction


GetLFCRCmd


-(NSData *_Nonnull) GetLFCRCmd; 
Return Value

NSData

Discussion

获取回车换行的指令 Get the carriage return line feed instruction


GetNullData


-(NSData *_Nullable) GetNullData; 
Return Value

NSData

Discussion

获取空的NSData Get empty NSData


GetOpenDrawerCmd:startTime:endTime:


- (NSData *) GetOpenDrawerCmd:(Byte)DrawerNumber startTime:(Byte)pulseStartTime 
        endTime:(Byte)PulseEndTime; 
Parameters
DrawerNumber

0:钱箱引脚2 (Drawer pin 2) 1:钱箱引脚5 (Drawer pin 5) default:0

pulseStartTime

default:5

PulseEndTime

default:0

Discussion

打开钱箱 Open the cashbox


GetPrintEndCmd


-(NSData *_Nullable) GetPrintEndCmd; 
Return Value

NSData

Discussion

获取打印结束的指令(针打是退纸用,TSC,CPCL是发送打印命令,ESC:回车换行指令) Get the end of the print order (Pincmd is used for rewinding, TSC, CPCL is to send print commands, ESC: carriage return line feed command)


GetPrintEndCmd:


-(NSData *_Nullable) GetPrintEndCmd:(NSInteger)copies; 
Parameters
copies

打印份数(适用于TSC,其他调用等同于GetPrintEndCmd) Print copies (for TSC, other calls equal to GetPrintEndCmd)

Return Value

NSData

Discussion

获取打印结束的指令(针打是退纸用,TSC,CPCL是发送打印命令,ESC:回车换行指令) Get the end of the print order (Pincmd is used for rewinding, TSC, CPCL is to send print commands, ESC: carriage return line feed command)


GetPrintStautsCmd:


- (NSData *) GetPrintStautsCmd:(PrintStautsCmd) printStautsCmd; 
Discussion

for RP410 ZPL Custom customer U.S.A CMC RP806 TSC Custom U.S.A MINI PACK


GetSelftestCmd


-(NSData *) GetSelftestCmd; 
Return Value

NSData

Discussion

获取打印自测页的指令 Get instructions to print a self-test page


GetTextCmd:text:


-(NSData *) GetTextCmd:(TextSetting *)textSetting text:(NSString *)text; 
Parameters
textSetting

文本设置 Text setting

text

输入的文本 Enter the text

Return Value

返回命令数据 Return command data

Discussion

根据textSetting 得到对应的文本指令 By textSetting get the corresponding text instruction


ImportData:


-(NSData *) ImportData:(nonnull NSString*) data; 
Parameters
data

要生成的数据 Data to be generated

Return Value

返回指定encodingType编码的数据 Returns data of the specified encodingType encoding

Discussion

生成指定encodingType编码的数据


MoveData:dest:index:


-(void)MoveData:(NSData *)source dest:(Byte *)dest index:(NSInteger *)index; 
Parameters
source

源数据 source data

dest

目的数据 dest data

index

当前索引 Current index

Discussion

把source的值赋值给dest,dest从index开始赋值,每赋一个字节index会加1 The value of the source assigned to dest, dest from the index assignment, each assigned a byte index will increase by one


MoveData:ibegin:len:dest:dindex:


-(void)MoveData:(Byte *)source ibegin:(NSInteger)ibegin len:(NSInteger) len 
        dest:(Byte *)dest dindex:(NSInteger *)dindex; 
Parameters
source

源数据 source data

ibegin

开始索引 start index

dest

目的数据 dest data

dindex

当前索引 Current index

Discussion

把source的值(从ibegin开始到,长度为len)赋值到dest,dest从index开始赋值,每赋一个字节index会加1 The source value (starting from ibegin to length len) assigned to dest, dest from the index assignment, each assigned a byte index will increase by 1


Properties

barcodeBufferSize
encodingType

barcodeBufferSize


@property (nonatomic) NSInteger barcodeBufferSize; 
Discussion

条形码结束后,要在打印几个结束符0x00, 默认为1 After the end of the bar code, to print a few end characters 0x00, the default is 1


encodingType


@property (nonatomic) EncodingType encodingType; 
Discussion

编码格式 Encoding Type